package com.sc.nft.enums;


import com.baomidou.mybatisplus.annotation.EnumValue;
import com.google.common.collect.Maps;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.compress.utils.Lists;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@AllArgsConstructor
@Getter
public enum EcologyIncomeTypeEnum {


    CYCLE_INCOME(1,"周期收益","所有人",0),
    RECOMMENDED_INCOME(2,"分享收益","直推人",0),

    NODE_CULTIVATION_AWARD_365(3,"生态节点培育奖（365天）","生态节点",365),
    NODE_CULTIVATION_AWARD_7(4,"生态节点培育奖（7天）","生态节点",7),

    NODE_CONTRIBUTION_AWARD_365(5,"生态节点贡献奖（365天）","生态节点",365),
    NODE_CONTRIBUTION_AWARD_7(6,"生态节点贡献奖（7天）","生态节点",7),

    ECOLOGICAL_NODE_POSITION_AWARD(7,"生态节点持仓奖","生态节点",0),

    ECOLOGICAL_CULTIVATION_AWARD_365(8,"生态培育奖（365天）","城主",365),
    ECOLOGICAL_CULTIVATION_AWARD_7(9,"生态培育奖（7天）","城主",7),

    CONTRIBUTION_AWARD_365(10,"生态贡献奖（365天）","城主",365),
    CONTRIBUTION_AWARD_7(11,"生态贡献奖（7天）","城主",7),


    COMMUNITY_ECOLOGICAL_CONTRIBUTION_AWARD_365(12,"社区生态贡献奖（365天）","社区网点",365),
    COMMUNITY_ECOLOGICAL_CONTRIBUTION_AWARD_7(13,"社区生态贡献奖（7天）","社区网点",7),


    CITY_CULTIVATION_AWARD_365(14,"城市生态培育奖（365天）","城市服务中心",365),
    CITY_CULTIVATION_AWARD_7(15,"城市生态培育奖（7天）","城市服务中心",7),

    CITY_CONTRIBUTION_AWARD_365(16,"城市生态贡献奖（365天）","城市服务中心",365),
    CITY_CONTRIBUTION_AWARD_7(17,"城市生态贡献奖（7天）","城市服务中心",7),


    DAO_CULTIVATION_AWARD(20,"DAO培育奖","DAO",0),
    DAO_CONTRIBUTION_AWARD(21,"DAO贡献奖","DAO",0),
    DAO_POSITION_BONUS_AWARD(22,"DAO持仓奖","DAO",0),

    MATE_MAP(23,"版权地图收益","DAO",0),

//    NODE_CULTIVATION_AWARD_365(24,"生态节点培育奖（30天）","生态节点",30),
//
//    NODE_CONTRIBUTION_AWARD_365(25,"生态节点贡献奖（30天）","生态节点",30),
//
//    ECOLOGICAL_CULTIVATION_AWARD_365(26,"生态培育奖（30天）","城主",30),
//
//    CONTRIBUTION_AWARD_365(27,"生态贡献奖（30天）","城主",30),

    ;
    @EnumValue
    private int code;
    private String description;
    private String standing;
    private Integer day;


    public static Map<String,String> getAll() {
        Map<String,String> map = Maps.newLinkedHashMap();
        for (EcologyIncomeTypeEnum value : EcologyIncomeTypeEnum.values()) {
            if(value.code == 1){
                continue;
            }
            map.put(value.name(), value.getDescription());
        }
        return map;
    }

    public static Map<String,String> getDaoIncome() {
        Map<String,String> map = Maps.newLinkedHashMap();
        map.put(EcologyIncomeTypeEnum.DAO_CULTIVATION_AWARD.name(), EcologyIncomeTypeEnum.DAO_CULTIVATION_AWARD.getDescription());
        map.put(EcologyIncomeTypeEnum.DAO_CONTRIBUTION_AWARD.name(), EcologyIncomeTypeEnum.DAO_CONTRIBUTION_AWARD.getDescription());
        map.put(EcologyIncomeTypeEnum.DAO_POSITION_BONUS_AWARD.name(), EcologyIncomeTypeEnum.DAO_POSITION_BONUS_AWARD.getDescription());
        return map;
    }

    public static List<EcologyIncomeTypeEnum> getDaoIncomeList() {
        List<EcologyIncomeTypeEnum> list = Lists.newArrayList();
        list.add(EcologyIncomeTypeEnum.DAO_CULTIVATION_AWARD);
        list.add(EcologyIncomeTypeEnum.DAO_CONTRIBUTION_AWARD);
        list.add(EcologyIncomeTypeEnum.DAO_POSITION_BONUS_AWARD);
        return list;
    }

    public static List<EcologyIncomeTypeEnum> getplatformIncomeList() {
        List<EcologyIncomeTypeEnum> list = Lists.newArrayList();
        for (EcologyIncomeTypeEnum value : EcologyIncomeTypeEnum.values()) {
            if(value == CYCLE_INCOME || value == RECOMMENDED_INCOME){
                continue;
            }

            if(!getDaoIncomeList().contains(value)){
                list.add(value);
            }
        }
        return list;
    }

}
